<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:r="http://richfaces.org/rich" xmlns:a="http://richfaces.org/a4j"
	xmlns:ad="http://agiledev.com.br/fieldset">
	
	<r:dataTable id="dtComps" value="#{componentes}" var="scrumRole" width="100%" rowKeyVar="i">
	
		<r:column>
			<f:facet name="header">
				<h:outputText value="#{messages.usuario}"/>
			</f:facet>

			<s:decorate	template="/layout/editDet.xhtml" id="dUsuario">
				<h:inputHidden id="ihOid" value="#{scrumRole.user.oid}" required="true"/>
				<h:inputText id="user" value="#{scrumRole.user.nome}" size="50" maxlength="100"/> 
			</s:decorate>
			
			<r:suggestionbox id="sbUser" for="user" suggestionAction="#{userSugestionMB.autocomplete}" var="user" 
				nothingLabel="#{messages.msgRegistroNaoEncontrado}" fetchValue="#{user.descricao}" minChars="2"
				limitToList="true" usingSuggestObjects="true" width="400" onobjectchange="setDadosSB(suggestion, 'fTeam:dtComps:#{i}:dUsuario:ihOid', 'fTeam:dtComps:#{i}:dUsuario:user')">

				<h:column>
                	<h:outputText value="#{user.descricao}" />
				</h:column>
				<h:column>
					<h:outputText value="#{user.nome}" />
				</h:column>
			</r:suggestionbox>
		</r:column>

		<r:column>
			<f:facet name="header">
				<h:outputText value="#{messages.role}"/>
			</f:facet>
			
			<h:selectOneMenu id="tipo" value="#{scrumRole.type}" required="true">
				<s:convertEnum />
				<s:enumItem enumValue="scrumTeam" label="#{messages.scrumTeam}"/>
				<s:enumItem enumValue="scrumMaster" label="#{messages.scrumMaster}"/>
				<s:enumItem enumValue="productOwner" label="#{messages.productOwner}" />
			</h:selectOneMenu>

		</r:column>		

		<r:column styleClass="centro" width="10%">
			<f:facet name="header">
				<h:outputText value="#{messages.acoes}" />
			</f:facet>
			
			<a:commandButton image="/img/bin.png" actionListener="#{teamMB.removeComponent}" styleClass="imgAcao" ajaxSingle="true" rendered="#{not empty scrumRole.oid}"></a:commandButton>
			<a:commandButton image="/img/add.png" actionListener="#{teamMB.persistComponent}" styleClass="imgAcao" ajaxSingle="true" rendered="#{empty scrumRole.oid}"></a:commandButton>
		</r:column>

	
	</r:dataTable>
		
</ui:composition>